'use strict';

const Sequelize = require('sequelize');
const sequelize = require('../plugins/db');

const Model = Sequelize.Model;
class Config extends Model {}

// 静态属性：主键字段名称
Config.pk = 'id';
Config.init({
    id: {
      type: Sequelize.INTEGER,
      autoIncrement: true,
      primaryKey: true,
      comment: '配置id'
    },
    scope: {
      type:  Sequelize.STRING,
      comment: '范围'
    },
    name: {
      type:  Sequelize.STRING,
      allowNull: false,
      comment: '配置名'
    },
    value: {
      type: Sequelize.STRING,
      callowNull: false,
      comment: '配置值'
    },
    remark: {
      type: Sequelize.STRING,
      comment: '备注'
    }
}, {
    sequelize,
    tableName: 'config',
    freezeTableName: true,
    timestamps: true
});
module.exports = Config;
